package ca.uoit.csci2020u.classes;

import ca.uoit.csci2020u.interfaces.Shape;

public abstract class Sphere implements Shape {
	// Any variables used in the subclass must be marked either public OR protected.  Private variables can ONLY be used in the same class in which it's defined.
	protected float R;

	abstract public String getColor();

	// Any super class MUST have a default constructor.  It is implicitly called by any subclasses.  If you don't want it called by other classes, mark it as protected.  Marking it public will allow any class that imports your class to instantiate it.
	protected Sphere() {}

	protected Sphere(float radius) {
		this.R = radius;
	}

	@Override
	public float volume() {
		return (float)(4.0f / 3.0f *
				Math.PI * Math.pow(this.R, 3));
	}

	@Override
	public String toString() {
		return this.getColor() +
			" sphere with a radius of " + this.R +
			" and a volume of " + this.volume();
	}
}
